public final class Complex {
...
public static final Complex ZERO = new Complex(0);
public Complex add(Complex that) {
return new Complex(this.re + that.re,
this.im + that.im);
}
public boolean equals(Object x) {
return x instanceof Complex && re == ...
}
public int hashCode() {
long bits = Double.doubleToLongBits(re) ^ ...
return (int)(bits ^ (bits >> 32));
}
...
|